//
//  CuoTiLvHeader.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/6/20.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "CuoTiLvHeader.h"

@implementation CuoTiLvHeader

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
        [self initOption];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = [UIColor whiteColor];
    self.frame = CGRectMake(0, 0, self.frame.size.width, 50);
    [self addSubview:self.backView];
    [_backView addSubview:self.kaoShiNameLabel];
    [_backView addSubview:self.closeButton];
}
- (void)initOption{
    [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.top.equalTo(@0);
        make.right.equalTo(@0).offset(-0);
        make.bottom.equalTo(@0);
    }];
    [_kaoShiNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@0);
        make.bottom.equalTo(@0);
    }];
    [_closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self->_backView.mas_centerY);
        make.right.equalTo(@0).offset(-10);
        make.width.equalTo(@15);
        make.height.equalTo(@15);
    }];
}
- (UIButton *)closeButton{
    if (!_closeButton) {
        UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
//        [but addTarget:self action:@selector(closeClick:) forControlEvents:UIControlEventTouchUpInside];
        _closeButton = but;
    }
    return _closeButton;
}

- (UIView *)backView{
    if (!_backView) {
        UIView *view = [[UIView alloc]init];
//        view.backgroundColor = BACKLINECOLOR;
        view.userInteractionEnabled = YES;
        _backView = view;
    }
    return _backView;
}
- (UILabel *)kaoShiNameLabel{
    if (!_kaoShiNameLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.textColor = TITLECOLOR;
        label.text = @"考试名称：       考试时间： ";
        label.font = [UIFont systemFontOfSize:14];
        _kaoShiNameLabel = label;
    }
    return _kaoShiNameLabel;
}
- (void)drawRect:(CGRect)rect{

}
@end
